package com.example.mqspring.rabiitmqbasicleverone.rabbitmqBroadcast;

import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.DefaultConsumer;
import com.rabbitmq.client.Envelope;

import java.io.IOException;

/**
 * 消费广播出的东西
 */
public class MessageReceiver extends DefaultConsumer {

    private String exchange;
    /**
     */

    public MessageReceiver(Channel channel,String exchange) {
        super(channel);
        this.exchange = exchange;
    }

    @Override
    public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {

        System.out.println("进入消费:"+new String(body));

    }
}
